1. Field of the Invention
The present invention relates to data processing systems, and more particularly to a method and apparatus for handling the removal of memory cards from a computer system.
2. Art Background
Recent advances in computer technology have made it possible to execute instruction code directly off of removable memory cards that are inserted into sockets on a processor circuit board. The cards typically are comprised of a read only memory (ROM), a static random access memory (SRAM), an erasable programmable read only memory (EPROM) or a flash memory. Upon insertion of the card into the socket, the address space of the card is mapped into the address space of the processor to permit execution of program code resident on the card.
Removable memory cards provide great flexibility to both the user and the computer service technician. As just a few examples, the cards can be used to provide bootstrap or test programs that can be quickly installed into the system. Because instructions are directly executable off of the cards, the user saves the time that would be required to load the card resident programs into system memory.
One problem with existing memory card technology is that the accidental removal of a card can lead to unreliable system behavior if the card is removed without the system first suspending execution of card-resident programs. To overcome this problem, some card connectors are provided with a mechanical lock that prevents the card from being removed until it is unlocked. The act of unlocking generates an interrupt to the system that triggers suspension of access to the card. A disadvantage of this solution is that the required locking hardware is relatively expensive.
All connectors implementing the Personal Computer Memory Card International Association (PCMCIA) standard utilize card detect pins that are shorter than the signal pins in the connector. Upon insertion of the card, the card detect pins of the socket contact the card last to indicate the presence of the card in the socket. These pins also break contact first upon card removal in order to signal the system that it should suspend access to the card.
The existing card standard exhibits two major reliability problems: (i) noise on the signal lines; and (ii) inadequate time for system response. First, as the card is being removed, the signal pins of the socket connector on the system side scrape against the corresponding holes of the connector on the card side, thus generating noise on the signal pins. This noise can cause unreliable system operation. Second, the existing standard only provides for a very short amount of time for the system to respond to card removal before the signal pins break contact.
The accidental removal of memory cards during the execution of card-resident software also leads to the creation of an invalid processor state. Whether on-card or off-card, most software executes procedure calls to different areas of system memory. This requires the processor to set its program counter to the address of the first instruction in the called procedure. To ensure resumption of execution of the calling program after the called routine has completed execution, the processor maintains a stack of "next instruction pointers" that point to the instruction to be executed in the calling program after the procedure call. Each next instruction pointer on the stack is also the last component of a stack frame that includes local variables pushed onto the stack for temporary use by the calling program.
As card resident code executes and calls routines either on-card or off-card, both local variables used by the card resident code and next instruction pointers referring to memory locations on the card are pushed onto the stack. When execution of card-resident is interrupted by accidental card removal, the stack frames relating to locations on the card are invalid unless the card is reinserted. Thus, there is need for an interrupt handler that responds to the break in the card detect pins to ensure that the invalid stack frames do not lead to unreliable system operation.